package foo.brindille.servlet;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;
import com.sun.jersey.guice.JerseyServletModule;
import com.sun.jersey.guice.spi.container.servlet.GuiceContainer;

import foo.brindille.template.TemplateProvider;
import foo.brindille.web.Base;

public class GuiceServletConfig  extends GuiceServletContextListener {
    
    @Override
    protected Injector getInjector() {
        return Guice.createInjector(new JerseyServletModule() {

            @Override
            protected void configureServlets() {

                /* bind the REST resources */
                bind(Base.class);
                bind(TemplateProvider.class);
//
//                /* bind jackson converters for JAXB/JSON serialization */
//                bind(MessageBodyReader.class).to(JacksonJsonProvider.class);
//                bind(MessageBodyWriter.class).to(JacksonJsonProvider.class);

                serve("/*").with(GuiceContainer.class);

            }
        });
    }
}
